package interfaces;

import java.util.logging.Level;
import interfaces.DebugHandler;

import money.Money;



public class BankProxy implements UserInterface{
	
	private UserInterface bankproxy;
	
	public BankProxy(UserInterface bank){
		this.bankproxy = bank;
	}

	@Override
	public String accountStatement(int accountNumber, String mimeType) throws Exception {
		DebugHandler.logger.log(Level.FINE, "account Statement " + accountNumber);
		return bankproxy.accountStatement(accountNumber, mimeType);
	}

	@Override
	public void addMoney(Money lInput, String reason, int accountNumber)
			throws Exception {
		
		if(lInput.getValue() > 100000){
			DebugHandler.logger.log(Level.SEVERE, "addMoney" + " Value:" + lInput + " Reason: " + reason +
					" Account Number: " + accountNumber + "\n can't handle the amount of money");
		}
		else{
		DebugHandler.logger.log(Level.FINE, "addMoney" + " Value:" + lInput + " Reason: " + reason + " Account Number: " + accountNumber);
		bankproxy.addMoney(lInput, reason, accountNumber);
		}
	}

	@Override
	public void chooseAccount(int AccountNumber) throws Exception {
		DebugHandler.logger.log(Level.FINE, "choose Account" + AccountNumber);
		bankproxy.chooseAccount(AccountNumber);
	}

	@Override
	public void interestAll(int accountNumber) throws Exception {
		DebugHandler.logger.log(Level.FINE, "interest All", accountNumber);
		bankproxy.chooseAccount(accountNumber);
	}

	@Override
	public void newDepositAccount(int accountNumber, String AccountNameDep, int runtime,
			String language, String country) throws Exception {
		
		DebugHandler.logger.log(Level.FINE, "new Deposit Account" + AccountNameDep + runtime + language + country);
		bankproxy.newDepositAccount(accountNumber ,AccountNameDep, runtime, language, country);
	}

	@Override
	public void newGiroAccount(int accountNumber, String AccountNameGiro, int creditrating,
			String language, String country) throws Exception {
		
		DebugHandler.logger.log(Level.FINE, "new Deposit Account" + AccountNameGiro + creditrating + language + country);
		bankproxy.newGiroAccount(accountNumber, AccountNameGiro, creditrating, language, country);
	}

	@Override
	public void removeMoney(Money lInput, String reason, int accountNumber)
			throws Exception {
		
		DebugHandler.logger.log(Level.FINE, "remove Money" + lInput + reason + accountNumber);
		bankproxy.removeMoney(lInput, reason, accountNumber);
	}

	@Override
	public String showAccountValue(int accountNumber) throws Exception {

		DebugHandler.logger.log(Level.FINE, "show Account Value" + accountNumber);
		
		return bankproxy.showAccountValue(accountNumber);
	}

	@Override
	public void transferMoney(int acceptor, Money value, String reason,
			int accountNumber) throws Exception {
		
		DebugHandler.logger.log(Level.FINE, "transfer Money" + acceptor + value + reason + accountNumber);
		bankproxy.transferMoney(acceptor, value, reason, accountNumber);
	}

	
}
